<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class SchoolInfo extends Model
{
    protected $guarded = [];
    protected $table = 'school_info';

    /* 审核状态 */
    const STATUS_PENDING_REVIEW = 0; // 待审核
    const STATUS_PASS = 1;           // 审核通过
    const STATUS_REJECT = 2;         // 审核驳回

    public function owner()
    {
        return $this->belongsTo(User::class, 'user_id', 'id');
    }

    public function getStatusAttribute($status)
    {
        switch ($status) {
            case self::STATUS_PENDING_REVIEW:
                return "审核中";
            case self::STATUS_PASS:
                return "审核通过";
            case self::STATUS_REJECT:
                return "审核驳回";
        }
    }
}
